var vm = new Vue({
    el: '#main',
    data: {
        versionObj:{
            systemNo:'',
            systemName:'',
            systemChargePop:'',
            systemPhone:'',
            systemPhoneType:'',
            systemUrl:'',
            systemDateUrl:'',
            serverConStr:'',
            fileUrl:'',
            fileName:'',
            autoFlag:'1',
        },
        tips:'',
    },
    mounted: function () {
    },
    methods:{
        //返回-----------111111----------
        back(){
            window.location.href =
            "systemEnqu.html";
        },
        //测试一下
        resetBtn(){
            let promes = {
                serverConStr:this.versionObj.serverConStr,
            };
            axios({
                method: "post",
                url: App.envUrl.backtrackUrl+"sysMaintain/testConnect",
                data: promes,
            })
            .then((data) => {
                if(data.data.code === '200'){
                    $('#my-alert').modal({
                        relatedTarget: this,
                    });
                    this.tips = '服务器可连接';
                }
            })
            .catch((err) => {});

        },
        submit(){
            let zz = /^[a-zA-Z0-9_-]+@[0-9.]+:[0-9]+$/;
            if(this.versionObj.serverConStr){
                if(!zz.test(this.versionObj.serverConStr)){
                    $('#my-alert').modal({
                        relatedTarget: this,
                    });
                    this.tips = '请按提示填写服务器连接串';
                    return;
                }
            }
            let obj = {
                systemNo:this.versionObj.systemNo,
                systemName:this.versionObj.systemName,
                systemChargePop:this.versionObj.systemChargePop,
                systemPhone:this.versionObj.systemPhone,
                systemPhoneType:this.versionObj.systemPhoneType,
                systemUrl:this.versionObj.systemUrl,
                systemDateUrl:this.versionObj.systemDateUrl,
                serverConStr:this.versionObj.serverConStr,
                fileUrl:this.versionObj.fileUrl,
                fileName:this.versionObj.fileName,
                autoFlag:this.versionObj.autoFlag,
                systemFlagStr:this.versionObj.systemFlagStr,
            }
            axios({
                method: "post",
                url: App.envUrl.backtrackUrl+"sysMaintain/saveSysMaintain",
                data: obj,
            })
            .then((data) => {
                console.log(data.data.data);
                if(data.data.code === '200'){
                    window.location.href =
                    "systemEnqu.html";
                }else{
                    $('#my-alert').modal({
                        relatedTarget: this,
                    });
                    this.tips = '新增失败！';
                }
            })
            .catch((err) => {});
        },
        radioChangez(val){
           this.versionObj.autoFlag = '1';
        },
        radioChanges(val){
            this.versionObj.autoFlag = '0'
        }
    }
   
});